package com.mingke.java.GroupChatPro;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.channels.AsynchronousServerSocketChannel;

/**
 * @author mingke
 * @function 群聊系统Pro服务端程序
 * @date 2021/11/10
 */
public class GroupServerHandler {

    public void startServer(){
        InetSocketAddress socketAddress = new InetSocketAddress(2021);
        final AsynchronousServerSocketChannel serverSocketChannel;
        try {
            serverSocketChannel = AsynchronousServerSocketChannel.open();
            serverSocketChannel.bind(socketAddress);
            serverSocketChannel.accept(serverSocketChannel, new GroupAcceptHandler());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
